/*
 * @Date: 2025-06-13 10:40:53
 * @Auth: 463997479@qq.com
 * @LastEditors: 463997479@qq.com
 * @LastEditTime: 2025-06-19 11:09:01
 * @FilePath: \corpus\src\components\UploadCorpus\index.tsx
 */
import { InboxOutlined } from '@ant-design/icons';
import { message, Upload } from 'antd';
import React from 'react';
const { Dragger } = Upload;

const UploadCorpus: React.FC = (props: Record<any, any>) => {
  const { multiple = false } = props;
  return (
    <Dragger
      {...props}
      multiple={multiple}
      onChange={(info) => {
        const { status } = info.file;
        if (status !== 'uploading') {
        }
        if (status === 'done') {
          message.success(`${info.file.name} 文件上传成功`);
          props?.handleChange(info);
        } else if (status === 'error') {
          message.error(`${info.file.name} file upload failed.`);
        }
      }}
    >
      <p className="ant-upload-drag-icon">
        <InboxOutlined />
      </p>
      <p className="ant-upload-text">请点击或者拖拽文件到这个区域上传</p>
    </Dragger>
  );
};

export default UploadCorpus;
